<template>
  <div>
    <el-form
      :inline="true"
      class="login-container"
      :model="form"
      :rules="rules"
      ref="loginForm"
      label-width="70px"
    >
      <h3 class="login_title">系统登陆</h3>
      <el-form-item label="用户名" prop="username">
        <el-input v-model="form.username" placeholder="请输入用户名"></el-input>
      </el-form-item>
      <el-form-item label="密码" prop="password">
        <el-input
          type="password"
          v-model="form.password"
          placeholder="请输入密码"
        ></el-input>
      </el-form-item>
      <el-form-item>
        <el-button style="margin-left: 105px" type="primary" @click="login"
          >登录</el-button
        >
      </el-form-item>
    </el-form>
  </div>
</template>
<script>
export default {
  data () {
    return {
      form: {
        username: '',
        password: ''
      },
      rules: {
        username: [
          { required: true, message: '请输入用户名', trigger: 'blur' },
          { min: 3, max: 5, message: '长度在 3 到 5 个字符', trigger: 'blur' }
        ],
        password: [
          { required: true, message: '请输入密码', trigger: 'blur' },
          { min: 6, max: 10, message: '长度在 6 到 10 个', trigger: 'blur' }
        ]
      }
    }
  }
}
</script>
<style lang="less" scoped>
body {
  background-image: url('~@/assets/images/user.png'); /* 替换为你的图片路径 */
  background-size: cover; /* 使背景图片覆盖整个页面 */
  background-position: center; /* 使背景图片居中 */
  background-repeat: no-repeat; /* 防止背景图片重复 */
  height: 100vh; /* 使背景图片高度占满整个视口 */
  margin: 0; /* 去除默认的body边距 */
}
.login-container {
  width: 350px;
  border: 1px solid #eaeaea;
  margin: 130px auto;
  padding: 35px 35px 15px 35px;
  background-color: #fff;
  border-radius: 15px;
  box-shadow: 0 0 25px #cac6c6;
  box-sizing: border-box;
  .login_title {
    text-align: center;
    margin-bottom: 40px;
    color: #505458;
  }
  .el-input {
    width: 198px;
  }
}
</style>
